<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="utf-8">
  <title>hinnn-hiprint</title>
  <!-- hiprint -->
  <link href="https://ssm.meizhitech.com/hiprint/css/hiprint.css" rel="stylesheet">
  <link href="https://ssm.meizhitech.com/hiprint/css/print-lock.css" rel="stylesheet">
  <link href="https://ssm.meizhitech.com/hiprint/css/print-lock.css" media="print" rel="stylesheet">

  <!-- jQuery (hiprint 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
  <script src="https://ssm.meizhitech.com/hiprint/plugins/jq-3.31.js"></script>
  <!-- polyfill.min.js解决浏览器兼容性问题v6.26.0-->
  <script src="https://ssm.meizhitech.com/hiprint/polyfill.min.js"></script>
  <!-- hiprint 核心js-->
  <script src="https://ssm.meizhitech.com/hiprint/hiprint.bundle.js"></script>
  <!-- 条形码生成组件-->
  <script src="https://ssm.meizhitech.com/hiprint/plugins/JsBarcode.all.min.js"></script>
  <!-- 二维码生成组件-->
  <script src="https://ssm.meizhitech.com/hiprint/plugins/qrcode.js"></script>
  <!-- 调用浏览器打印窗口helper类，可自行替换-->
  <script src="https://ssm.meizhitech.com/hiprint/plugins/jquery.hiwprint.js"></script>
</head>

<body>
  <h1 id="test"></h1>
  <div id="report-cont"></div>
</body>
<!-- hiprint 打印初始化，更多参数请查看文档 -->
<script>
  window.onload = () => {
    hiprint.init();
    let templateJson = {
      "panels": [
        {
          "name": 1,
          "index": 0,
          "width": 210,
          "height": 296.6,
          "paperFooter": 840.7559055118112,
          "paperHeader": 0,
          "printElements": [
            {
              "options": {
                "top": 66,
                "left": 73.5,
                "field": "archiveNo",
                "title": "档号",
                "width": 120,
                "height": 9.75,
                "isData": true
              },
              "printElementType": {
                "type": "text",
                "title": "档号"
              }
            },
            {
              "options": {
                "top": 97.5,
                "left": 76.5,
                "field": "filingYear",
                "title": "年度",
                "width": 120,
                "height": 9.75,
                "isData": true
              },
              "printElementType": {
                "type": "text",
                "title": "年度"
              }
            },
            {
              "options": {
                "top": 186,
                "left": 16.5,
                "field": "table_2",
                "width": 550,
                "fields": [
                  {
                    "text": "档号",
                    "field": "archiveNo"
                  },
                  {
                    "text": "业务系统名称",
                    "field": "businessSystemName"
                  },
                  {
                    "text": "立档单位（部门）代码",
                    "field": "departmentCode"
                  },
                  {
                    "text": "立档单位（部门）名称",
                    "field": "departmentName"
                  },
                  {
                    "text": "档案门类代码",
                    "field": "archiveCategoryCode"
                  },
                  {
                    "text": "档案门类名称",
                    "field": "archiveCategoryName"
                  },
                  {
                    "text": "业务流水号",
                    "field": "businessNo"
                  },
                  {
                    "text": "档案名称",
                    "field": "archiveName"
                  },
                  {
                    "text": "实体档案标志",
                    "field": "entityFlag"
                  },
                  {
                    "text": "年度",
                    "field": "filingYear"
                  },
                  {
                    "text": "保管期限",
                    "field": "retentionPeriod"
                  },
                  {
                    "text": "密级",
                    "field": "classification"
                  },
                  {
                    "text": "全宗号",
                    "field": "fondCode"
                  },
                  {
                    "text": "机构（问题）代码",
                    "field": "organOrProblem"
                  },
                  {
                    "text": "件号",
                    "field": "partNo"
                  },
                  {
                    "text": "案卷号",
                    "field": "caseNo"
                  },
                  {
                    "text": "页号",
                    "field": "pageNo"
                  },
                  {
                    "text": "册号",
                    "field": "volumeNo"
                  },
                  {
                    "text": "组号",
                    "field": "groupNo"
                  }
                ],
                "height": 36,
                "columns": [
                  [
                    {
                      "field": "businessSystemName",
                      "fixed": false,
                      "title": "业务系统名称",
                      "width": 275,
                      "checked": true,
                      "colspan": 1,
                      "rowspan": 1,
                      "columnId": "businessSystemName"
                    },
                    {
                      "field": "archiveNo",
                      "fixed": false,
                      "title": "档号",
                      "width": 275,
                      "checked": true,
                      "colspan": 1,
                      "rowspan": 1,
                      "columnId": "archiveNo"
                    }
                  ]
                ],
                "coordinateSync": false,
                "widthHeightSync": false,
                "custom_dataSource_id": "basicInfo"
              },
              "printElementType": {
                "type": "table",
                "title": "空白表格",
                "editable": true,
                "columnResizable": true,
                "isEnableDeleteRow": true,
                "isEnableEditField": true,
                "isEnableInsertRow": true,
                "isEnableMergeCell": true,
                "columnAlignEditable": true,
                "columnTitleEditable": true,
                "isEnableContextMenu": true,
                "isEnableDeleteColumn": true,
                "isEnableInsertColumn": true,
                "columnDisplayEditable": true,
                "columnDisplayIndexEditable": true
              }
            },
            {
              "options": {
                "top": 289.5,
                "left": 21,
                "field": "table_3",
                "width": 550,
                "fields": [
                  {
                    "text": "文件下载地址",
                    "field": "fileUrl"
                  },
                  {
                    "text": "归档材料名称",
                    "field": "fileName"
                  },
                  {
                    "text": "文件大小",
                    "field": "fileSize"
                  },
                  {
                    "text": "电子文件名称",
                    "field": "originalName"
                  },
                  {
                    "text": "页数",
                    "field": "page"
                  },
                  {
                    "text": "文件格式信息",
                    "field": "fileFormat"
                  },
                  {
                    "text": "文件形成时间",
                    "field": "fileFormationTime"
                  },
                  {
                    "text": "文件创建程序",
                    "field": "fileCreation"
                  },
                  {
                    "text": "文件签署验签报告",
                    "field": "signReport"
                  },
                  {
                    "text": "文件hash值",
                    "field": "fileHash"
                  },
                  {
                    "text": "文件形成环节代码",
                    "field": "fileNodeCode"
                  },
                  {
                    "text": "文件id",
                    "field": "fileId"
                  },
                  {
                    "text": "扩展信息",
                    "field": "extension"
                  },
                  {
                    "text": "父级名称",
                    "field": "parentName"
                  },
                  {
                    "text": "文件内容信息",
                    "field": "fileContent"
                  }
                ],
                "height": 36,
                "columns": [
                  [
                    {
                      "field": "originalName",
                      "fixed": false,
                      "title": "电子文件名称",
                      "width": 275,
                      "checked": true,
                      "colspan": 1,
                      "rowspan": 1,
                      "columnId": "originalName"
                    },
                    {
                      "field": "fileUrl",
                      "fixed": false,
                      "title": "文件下载地址",
                      "width": 275,
                      "checked": true,
                      "colspan": 1,
                      "rowspan": 1,
                      "columnId": "fileUrl"
                    }
                  ]
                ],
                "coordinateSync": false,
                "widthHeightSync": false,
                "custom_dataSource_id": "fileInfo"
              },
              "printElementType": {
                "type": "table",
                "title": "空白表格",
                "editable": true,
                "columnResizable": true,
                "isEnableDeleteRow": true,
                "isEnableEditField": true,
                "isEnableInsertRow": true,
                "isEnableMergeCell": true,
                "columnAlignEditable": true,
                "columnTitleEditable": true,
                "isEnableContextMenu": true,
                "isEnableDeleteColumn": true,
                "isEnableInsertColumn": true,
                "columnDisplayEditable": true,
                "columnDisplayIndexEditable": true
              }
            }
          ],
          "paperNumberTop": 819,
          "paperNumberLeft": 565,
          "watermarkOptions": {},
          "panelLayoutOptions": {},
          "paperNumberContinue": true
        }
      ]
    }
    var hiprintTemplate = new hiprint.PrintTemplate({
      template: templateJson
    });
    let printData = {
      archiveNo: "B001 • 1 • 2021 – 008",
      filingYear: "2021",
      table_2: [
        {
          "partNo": "008",
          "TaskCode": "1150011000930098234500116001000",
          "TaskType": "行政许可",
          "archiveNo": "B001 • 1 • 2021 – 008",
          "acceptTime": "2023-12-16 12:31:43",
          "applyInfos": [
            {
              "cardNo": "13",
              "cardType": "13",
              "applyName": "13",
              "applyPhone": "13",
              "applyMobile": "13",
              "legalPerson": "13",
              "nationality": "13",
              "applyAddress": "13",
              "cardTypeName": "13"
            }
          ],
          "businessNo": "AOS20231210920231216123234402",
          "entityFlag": "电子",
          "filingYear": "2021",
          "resultCode": "证件",
          "resultName": "通用",
          "resultType": "2023",
          "ArchiveTime": "2023-12-16 12:32:03",
          "TaskVersion": "42",
          "archiveName": "外部移交公文",
          "businessNo1": "5001199213XKCK20200521005781001001",
          "serviceName": "关于页岩气及氮气管线改造项目建设项目环境影响评价审批",
          "serviceType": "2022",
          "archiveName1": "名称",
          "completeTime": "2023-12-16 12:31:59",
          "DocumentNumber": "渝（江北）环准〔2021〕4号",
          "classification": "内部公开",
          "departmentCode": "20231208",
          "departmentName": "砂之船渝北奥特莱斯-接收单位",
          "leadDepartment": "责任处科室",
          "retentionPeriod": "长期",
          "receiveDepartment": "单位",
          "businessSystemName": "数字档案室一体化管理系统",
          "archiveCategoryCode": "B001",
          "archiveCategoryName": "政务服务",
          "InformationSystemDescription": "渝快政-电子公文"
        }
      ],
      table_3: [
        {
          "page": 1,
          "fileId": "1735880683268284416",
          "fileHash": "8fc69ca5483057f22aab15471f0b6c96905dbe10bdc1adb2656520f3bf1aafa5",
          "fileName": "行政许可决定书",
          "fileSize": 76634,
          "fileUuid": "9e6fc685-31b7-4c74-a543-72f116fd5122",
          "fileFormat": "docx",
          "originalName": "电子文件归档标准接口技术规范V1.0.0.docx",
          "fileFormationTime": "2023-10-27 09:39:42"
        },
        {
          "page": 1,
          "fileId": "1735880715249852416",
          "fileHash": "6f3f5b994fc54bbc492d00afb9ec7df3749d72f05ae5fffc46149f138cc42ed1",
          "fileName": "行政许可申请表",
          "fileSize": 19462,
          "fileUuid": "cf6fc4b0-cf86-452b-8dc8-364e4fbe7edb",
          "fileFormat": "xlsx",
          "originalName": "四性检测具体实现方案.xlsx",
          "fileFormationTime": "2023-11-06 11:32:10"
        }
      ]
    }

    console.log(hiprintTemplate)
    $('#report-cont').html(hiprintTemplate.getHtml(printData))
    $('#test').html("<span style='color:red;'>0000000</span>")
  }

</script>

</html>